package com.design.marketPrj.application.controller.product;

import com.design.marketPrj.application.bean.layuiJSON;
import com.design.marketPrj.application.controller.BaseController;
import com.design.marketPrj.application.service.ExcludeDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.FileNotFoundException;


@Controller
@RequestMapping("/product")
public class ProductListController extends BaseController {

    @Autowired
    private ExcludeDataService excludeDataService;

    @RequestMapping("/index")
    public String index(Model model){
        model.addAttribute("user",getUser());
        return "product/productIndex";
    }

    @RequestMapping("/list")
    @ResponseBody
    public layuiJSON getProductList(int page,int limit,String code){
        layuiJSON json = excludeDataService.getAllProductData(page,limit,code);
        return json;
    }

}
